const {url}=require('url')

let str="https://chst.vip:8081/data/index.json?name=李雷#aaa"

let res=new URL(str)
console.log(res.port);